/*
  File: RoleSystemMenuMapEntity.cs
  Author: rcrxy
  CreateTime: 2025/08/06 18:40

  Description: 角色 - 系统菜单 映射
*/

using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace StudentVideo.Data.Entities;

/// <summary>
/// 角色 - 系统菜单 映射
/// </summary>
[Table("role_system_menu_map")]
[Index(nameof(RoleId))]
[Index(nameof(SystemMenuId))]
[PrimaryKey(nameof(RoleId), nameof(SystemMenuId))]
public class RoleSystemMenuMapEntity {
   /// <summary>
   /// 角色 id
   /// </summary>
   [Required]
   [MaxLength(50)]
   public required string RoleId { get; set; }

   [ForeignKey(nameof(RoleId))]
   public required RoleEntity Role { get; set; }

   /// <summary>
   /// 系统菜单 id
   /// </summary>
   [Required]
   [MaxLength(50)]
   public required string SystemMenuId { get; set; }

   [ForeignKey(nameof(SystemMenuId))]
   public required SystemMenuEntity SystemMenu { get; set; }
}
